Skip to content

Fix React Native lifecycle, surface, and session edge cases - #310

Merged
schwartzmx merged 6 commits into
meta:mainfrom
schwartzmx:fix/react-native-runtime-corrections
Oct 31, 2026
Merged

schwartzmx merged 6 commits into
meta:mainfrom
schwartzmx:fix/react-native-runtime-corrections

Conversation

@schwartzmx

Copy link
Copy Markdown
Member

Fix React Native lifecycle, surface, and session edge cases

  • 831d6aa3 — Preserve replacement surfaces during stale cleanup

    • Prevents an old surface from unregistering a newer same-name replacement.
  • 41af3924 — Coalesce transient React Native app-state changes

    • Suppresses brief inactive transitions.
    • Correctly handles background-paused timers by emitting the held departure before the active return.
  • 52be5878 — Make React Native session timeout configurable

    • Adds sessionTimeoutMs while preserving the 30-minute default and invalid-value fallback.
  • 1e27ec8a — Rotate React Native sessions only on activity

    • Prevents heartbeats and other non-activity events from rotating or extending sessions.
    • Rotates before publishing the first UI or screen event after inactivity.
  • 6c0970c1 — Keep React Native event indexes monotonic

    • Preserves unique event indexes across session rotations.
    • Keeps cross-session mount/unmount relationships unambiguous.

Validation

  • React Native tests pass.
  • TypeScript checks pass.
  • Targeted ESLint and Prettier checks pass.
  • Runtime benchmarks remain within budget.
  • npm run build:mobile passes.
  • Web behavior is unchanged.

- Require child identity to match before removing a name-keyed surface.\n- Keep a newly registered replacement when an older instance unmounts.\n- Cover the shared hierarchy and React Native surface registry behavior.
- Add an opt-in hold for brief transitions away from the active state.
- Preserve the original departure timestamp and latest held state.
- Flush elapsed departures before active when backgrounded timers were paused.
- Keep immediate dispatch as the default and clear held timers on disposal.
- Cover lifecycle, heartbeat, and app-state publisher behavior.
- Accept a session timeout through plugin and compatibility initialization.\n- Preserve the thirty-minute default for omitted or invalid values.\n- Pass the timeout into the in-memory runtime session.\n- Cover custom rotation, activity refresh, and event-index reset behavior.
- Make session reads and ordinary event creation side-effect free.
- Rotate before publishing UI and screen activity after an idle timeout.
- Keep scheduled heartbeats in the current session without extending inactivity.
- Preserve timeout defaults and event-index reset behavior for this change.
- Cover idle heartbeat suppression, timeout boundaries, taps, and screens.
- Preserve the runtime event-index sequence across session rotation.
- Keep cross-session related-event references globally unambiguous.
- Verify session expiration continues the contiguous event sequence.
- Cover a surface mounted before rotation and unmounted afterward.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 22, 2026
- Publish the provisional runtime context before plugin lifecycle start hooks run.
- Let synchronous startup events resolve session and application identity.
- Keep AutoLogging.isInitialized false until initialization completes.
- Clear provisional context after installation or startup failures.
- Cover real heartbeat startup, rollback, disposal, and fresh retry behavior.
@schwartzmx
schwartzmx merged commit bf3e344 into meta:main Oct 31, 2026
2 checks passed
@schwartzmx
schwartzmx deleted the fix/react-native-runtime-corrections branch October 31, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant